// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// FREE SOURCE CODE
// http://www.magic-software.com/License/free.pdf

#ifndef MGCCUBICPOLYNOMIALCURVE3_H
#define MGCCUBICPOLYNOMIALCURVE3_H

#include "MgcPolynomialCurve3.h"


class MgcCubicPolynomialCurve3 : public MgcPolynomialCurve3
{
public:
    MgcCubicPolynomialCurve3 (MgcPolynomial* pkXPoly, MgcPolynomial* pkYPoly,
        MgcPolynomial* pkZPoly);
    virtual ~MgcCubicPolynomialCurve3 ();

    // tessellation data
    unsigned int GetVertexQuantity () const;
    MgcVector3* Vertices ();

    // tessellation by recursive subdivision
    void Tessellate (unsigned int uiLevel);

protected:
    // precomputation
    class IntervalParameters
    {
    public:
        unsigned int m_uiI0, m_uiI1;
        MgcVector3 m_akXuu[2];
    };

    // subdivide curve into two halves
    void Subdivide (unsigned int uiLevel, MgcReal fDSqr, MgcVector3* akX,
        IntervalParameters& rkIP);

    // tessellation data
    unsigned int m_uiVertexQuantity;
    MgcVector3* m_akVertex;
};

#include "MgcCubicPolynomialCurve3.inl"

#endif
